open Base
open Unique_id.Ids

type t =
  { event_handlers : Event.handler list
  ; vars : Behavior.vars }

let empty =
  { event_handlers = []
  ; vars = Var_id.empty_map }

let with_event_handler t ~f =
  { t with
    event_handlers = f :: t.event_handlers }

let with_var t var_id src =
  { t with
    vars = Map.set t.vars ~key:var_id ~data:src }

let bind_event_handlers t tree =
  List.iter t.event_handlers
    ~f:(Tree.add_event_handler tree)
